mydata <- read.csv2("Blood pressure.csv")
head(mydata)
## Pressure_A Pressure_B
## 1 82 90
## 2 80 90
## 3 88 99
## 4 108 118
## 5 116 123
## 6 136 137
Description of the variables:
library(pastecs)
round(stat.desc(mydata), 2)
## Pressure_A Pressure_B
## nbr.val 27.00 27.00
## nbr.null 0.00 0.00
## nbr.na 0.00 0.00
## min 63.00 76.00
## max 136.00 139.00
## range 73.00 63.00
## sum 2608.00 2754.00
## median 94.00 99.00
## mean 96.59 102.00
## SE.mean 3.46 3.06
## CI.mean.0.95 7.12 6.30
## var 323.87 253.62
## std.dev 18.00 15.93
## coef.var 0.19 0.16
mydata$Difference <- mydata$Pressure_A - mydata$Pressure_B
library(ggplot2)
ggplot(mydata, aes(x = Difference)) +
geom_histogram(position = "identity", binwidth = 3, colour = "black") +
ylab("Frequency") +
xlab("Difference")
shapiro.test(mydata$Difference)
##
## Shapiro-Wilk normality test
##
## data: mydata$Difference
## W = 0.95383, p-value = 0.2652
t.test(mydata$Pressure_A, mydata$Pressure_B,
paired = TRUE,
alternative = "two.sided")
##
## Paired t-test
##
## data: mydata$Pressure_A and mydata$Pressure_B
## t = -4.6867, df = 26, p-value = 7.686e-05
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -7.779049 -3.035766
## sample estimates:
## mean difference
## -5.407407
library(effectsize)
cohens_d(mydata$Difference)
## Cohen's d | 95% CI
## --------------------------
## -0.90 | [-1.34, -0.45]
interpret_cohens_d(0.90, rules = "sawilowsky2009")
## [1] "large"
## (Rules: sawilowsky2009)